<html ng-app="myApp"> <!-- 定义整个angulajs使用的上下文环境 -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>AngulaJs</title>
    <script type="text/javascript" src="angular/angular.js"></script>
</head>
<body>
<div ng-controller="myController">
    <h1>{{clock}}</h1>
</div>
<script type="text/javascript">
    var app = angular.module("myApp",[]) ; // 定义模块
    app.controller("myController", function($scope,$timeout){
        var updateClock = function(){
            $scope.clock = new Date().toLocaleString() ;
            $timeout(function(){
                updateClock() ;
            },1000) ;
        };
        updateClock();  // 要手工触发调用
    });
</script>
</body>
</html>
